package Demo2;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 34255
 * Date: 2024-06-04
 * Time: 16:49
 */

public class Point<T> {
    private T x;
    private T y;

    public Object getX() {
        return x;
    }

    public void setX(T x) {
        this.x = x;
    }

    public Object getY() {
        return y;
    }

    public void setY(T y) {
        this.y = y;
    }

}
class Test{
    public static void main(String[] args) throws Exception {

//        Point<Integer> point = new Point() ;
//        point.setX(10) ;    // 此处设置成int型（Integer型）
//        point.setY("北纬20度") ;
//        String x = (String) point.getX() ;
//        String y = (String) point.getY() ;
//        System.out.println("X的坐标是：" + x + "，Y的坐标是：" + y);
    }
}
